package org.ioc.com.book6.model;

import lombok.Data;
import org.ioc.com.book6.enums.ResultStatus;

@Data
public class Result<T> {
    private T data;
    private ResultStatus code;
    private String errMsg;


    public static<T> Result sucess(T data){
        Result result=new Result();
        result.setCode(ResultStatus.SUCESS);
        result.setData(data);
        return result;
    }
    public static<T> Result fail(){
        Result result=new Result();
        result.setCode(ResultStatus.FAIL);
        result.setErrMsg("失败啦");
        return result;
    }
    public static<T> Result nologin(){
        Result result=new Result();
        result.setCode(ResultStatus.NOLOGIN);
        result.setErrMsg("未登录");
        return result;
    }
}
